Image processing device, image processing method, and image processing program

ABSTRACT

An image processing device according to one embodiment includes an acquisition unit, a first specifying unit, and a second specifying unit. The acquisition unit acquires an edge between a text region where the translucent text is superimposed and a background region where the translucent text is not superimposed. The first specifying unit acquires a plurality of pairs of a representative color in the text region and a representative color in the background region adjacent to each other with the edge placed therebetween, and specifies a text color and transparency of the translucent text from the plurality of pairs. The second specifying unit specifies a pixel color before the translucent text is superimposed for each pixel in the text region from a pixel color after the translucent text is superimposed, the text color and the transparency.

CROSS REFERENCE TO RELATED APPLICATIONS

This application is a National Stage of International Application No.PCT/JP2013/057075 filed Mar. 13, 2013, the contents of all of which areincorporated herein by reference in their entirety.

TECHNICAL FIELD

One aspect of the present invention relates to an image processingdevice, an image processing method, and an image processing program.

BACKGROUND ART

There is a technique that removes text from an image and complementsthat region by using the pixels of the surrounding background region(see Non Patent Literature 1 below). By using such a technique, it ispossible to naturally restore the background hidden behind the text.

CITATION LIST Patent Literature

-   NPL1: He, Liu, Michael Bleyer, and Margrit Gelautz. “Object Removal    by Depth-guided Inpainting.” Austrian Association for Pattern    Recognition, 2011.

SUMMARY OF INVENTION Technical Problem

When the technique of the above-described Non Patent Literature 1 isapplied to an image in which a text region has transparency(translucent), the restoration of the background can be incomplete orinsufficient. According to the related art, information of thebackground covered by text is predicted using information of thesurrounding region. Thus, when a part of the background covered bytranslucent text is different from the surrounding region in design,that part is not restored to its original state, and a difference fromthe original background becomes significant. In view of the above, it isdesirable to more reliably restore the background covered by translucenttext.

Solution to Problem

An image processing device according to one aspect of the presentinvention is an image processing device for processing an image wheretranslucent text is superimposed on an original image, including anacquisition unit configured to acquire an edge between a text regionwhere the translucent text is superimposed and a background region wherethe translucent text is not superimposed, a pair acquisition unitconfigured to acquire a plurality of pairs of a representative color inthe text region and a representative color in the background regionadjacent to each other with the edge placed therebetween, a firstspecifying unit configured to specify a text color and transparency ofthe translucent text from the plurality of pairs, and a secondspecifying unit configured to specify a pixel color before thetranslucent text is superimposed for each pixel in the text region froma pixel color after the translucent text is superimposed, the text colorand the transparency.

An image processing method according to one aspect of the presentinvention is an image processing method performed by an image processingdevice for processing an image where translucent text is superimposed onan original image, the method including an acquisition step of acquiringan edge between a text region where the translucent text is superimposedand a background region where the translucent text is not superimposed,a pair acquisition step of acquiring a plurality of pairs of arepresentative color in the text region and a representative color inthe background region adjacent to each other with the edge placedtherebetween, a first specifying step of specifying a text color andtransparency of the translucent text from the plurality of pairs, and asecond specifying step of specifying a pixel color before thetranslucent text is superimposed for each pixel in the text region froma pixel color after the translucent text is superimposed, the text colorand the transparency.

An image processing program according to one aspect of the presentinvention is an image processing program causing a computer to functionas an image processing device for processing an image where translucenttext is superimposed on an original image, the program causing thecomputer to implement an acquisition unit configured to acquire an edgebetween a text region where the translucent text is superimposed and abackground region where the translucent text is not superimposed, a pairacquisition unit configured to acquire a plurality of pairs of arepresentative color in the text region and a representative color inthe background region adjacent to each other with the edge placedtherebetween, a first specifying unit configured to specify a text colorand transparency of the translucent text from the plurality of pairs,and a second specifying unit configured to specify a pixel color beforethe translucent text is superimposed for each pixel in the text regionfrom a pixel color after the translucent text is superimposed, the textcolor and the transparency.

A computer-readable recording medium according to one aspect of thepresent invention is a computer-readable recording medium that stores animage processing program causing a computer to function as an imageprocessing device for processing an image where translucent text issuperimposed on an original image, the program causing the computer toimplement an acquisition unit configured to acquire an edge between atext region where the translucent text is superimposed and a backgroundregion where the translucent text is not superimposed, a pairacquisition unit configured to acquire a plurality of pairs of arepresentative color in the text region and a representative color inthe background region adjacent to each other with the edge placedtherebetween, a first specifying unit configured to specify a text colorand transparency of the translucent text from the plurality of pairs,and a second specifying unit configured to specify a pixel color beforethe translucent text is superimposed for each pixel in the text regionfrom a pixel color after the translucent text is superimposed, the textcolor and the transparency.

According to the above aspects, the text color and the transparency oftranslucent text itself are obtained from a plurality of pairs of therepresentative color of the text region and the representative color ofthe background region. Because the pixel color of the text region is themixture of the pixel color before text is superimposed (originalbackground color) and the color of the text itself, if the color of thetranslucent text itself is determined, the pixel color of the textregion can be restored to the original background color. In this manner,by obtaining the color of the translucent text itself and thenspecifying the pixel color before superimposition for each pixel in thetext region, it is possible to more reliably restore the originalbackground on a pixel-by-pixel basis.

In the image processing device according to another aspect, asuperimposition color of each pixel in the text region where thetranslucent text is superimposed may be determined by a relationalexpression representing a relationship between the superimpositioncolor, a color of a corresponding pixel in the original image, and thetext color and the transparency of the translucent text, the pairacquisition unit may specify a first pair of a first superimpositioncolor in the text region and a first background color in the backgroundregion adjacent to each other with the edge placed therebetween and asecond pair of a second superimposition color in the text region and asecond background color in the background region adjacent to each otherwith the edge placed therebetween, the second superimposition colorbeing different from the first superimposition color and the secondbackground color being different from the first background color, thefirst specifying unit may specify the text color and the transparency ofthe translucent text based on a first equation where the first pair issubstituted into the relational expression and a second equation wherethe second pair is substituted into the relational expression, and thesecond specifying unit may specify a pixel value in the original imagefor each pixel in the text region based on the text color and thetransparency of the translucent text and the relational expression.

In the image processing device according to another aspect, the firstspecifying unit may perform color clustering to acquire a plurality ofpairs of a cluster of the text region and a cluster of the backgroundregion and acquire a representative color of each cluster to therebyacquire a plurality of pairs of a representative color in the textregion and a representative color in the background region.

In the image processing device according to another aspect, the firstspecifying unit may acquire a pair of a cluster of the text region and acluster of the background region when the cluster of the text region isplaced between the clusters of the two background regions with the samerepresentative color.

The image processing device according to another aspect may furtherinclude an inverse transform unit configured to obtain a range of pixelvalues in a small region centering on an edge of the translucent text onwhich anti-aliasing has been performed, and binarizes each pixel valuein the small region to one of a first reference value and a secondreference value.

The first reference value and the second reference value may be endpoints of the range of pixel values.

In the image processing device according to another aspect, the firstspecifying unit may acquire a rectangular region including thebackground region and the text region where the translucent text onwhich anti-aliasing has been performed is located, and acquires therepresentative color of each of the text region and the backgroundregion adjacent to each other with the edge in a direction along anouter edge of the rectangle region placed therebetween.

In the image processing device according to another aspect, the firstspecifying unit may acquire statistics of pixel values of each clusteras a representative color.

In the image processing device according to another aspect, theacquisition unit may determine that text is translucent when pixelvalues of a text part are dispersed.

In the image processing device according to another aspect, theacquisition unit may determine that text is translucent when there is anedge continuous from the background region to the text region.

Advantageous Effects of Invention

According to one aspect of the present invention, it is possible to morereliably restore the background covered by translucent text.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a view showing the concept of restoration processing accordingto an embodiment.

FIG. 2 is a view showing the concept of restoration processing accordingto the embodiment.

FIG. 3 is a view showing a hardware configuration of an image processingdevice according to the embodiment.

FIG. 4 is a block diagram showing a functional configuration of theimage processing device according to the embodiment.

FIG. 5 is a flowchart showing an operation of the image processingdevice according to the embodiment.

FIG. 6 is a view showing a configuration of an image processing programaccording to the embodiment.

FIG. 7 is a view illustrating processing using Histogram of OrientedGradient (HOG).

FIG. 8 is a view showing an example of anti-aliasing.

DESCRIPTION OF EMBODIMENTS

An embodiment of the present invention is described hereinafter indetail with reference to the appended drawings. Note that, in thedescription of the drawings, the same or equivalent elements are denotedby the same reference symbols, and the redundant explanation thereof isomitted.

The functions and configuration of an image processing device 10according to an embodiment are described hereinafter with reference toFIGS. 1 to 4. The image processing device 10 is a computer system thatremoves translucent text superimposed on an original image and restoresthe background hidden by the translucent text. Note that “text” in thisspecification is the concept including a mark, a figure or the like of acertain shape. Further, “translucent text” in this specification is texthaving transparency. The transparency is defined as 0 to 1. When thetransparency is 0, the text is solid, and when the transparency is 1,the text is completely transparent. Accordingly, in this specification,the transparency of translucent text is more than 0 and less than 1. Aspecific value of transparency is not particularly limited as long as itis within the above range.

The concept of restoration processing in this embodiment is describedhereinafter with reference to FIGS. 1 and 2. The image processing device10 receives input of a text image generated by superimposing translucenttext on an original image. The image processing device 10 acquires arectangular region circumscribing the text (circumscribing rectangle)from the text image and specifies the boundary (edge) between thebackground region and the text region in each circumscribing rectangle.

Next, the image processing device 10 specifies a region to be processed(which is referred to hereinafter as “target region”), where thebackground is to be restored. The target region includes a backgroundregion in which translucent text is not superimposed and a text regionin which translucent text is superimposed, and it is composed of one ora plurality of circumscribing rectangles. The target region L shown inFIG. 1 is one circumscribing rectangle where the translucent text K issuperimposed on the background J. In this embodiment, it is assumed thatthe color and transparency of translucent text itself are uniform.

Then, the image processing device 10 performs color clustering on bothof the background region and the text region, and acquires a pluralityof pairs of the representative color of the background region and therepresentative color (representative superimposition color) of the textregion which are adjacent to each other with the edge placedtherebetween in the target region L. In the example of FIG. 1, the imageprocessing device 10 acquires a first pair of the representative colorO₁ of the background region and the representative color I₁ of the textregion and a second pair of the representative color O₂ of thebackground region and the representative color I₂ of the text region.

After that, the image processing device 10 specifies the text color Tand the transparency r of the translucent text itself from the twopairs. The image processing device 10 then specifies and restores theoriginal color of each pixel in the region covered by the translucenttext from the color of the translucent text itself and the color of thetext region. By this processing, the background J is restored. Becausethe restoration is performed for each pixel, the circles Jp and Jq arealso restored that have been completely hidden by the translucent textK.

The restoration of the background is based on the following relationalexpression (1):I=Or+(1−r)T  (1)where the variable O is the color of the background itself covered bythe translucent text, and it is the color restored by the imageprocessing device 10. The variables T and r are the text color and thetransparency of the translucent text itself as described above. Thevariable I is the color of a pixel in the text region after thetranslucent text is superimposed (the apparent color in the text image).The variable I is, in other words, the mixture of the color of thebackground itself and the color of the translucent text itself.

Although the target region is one circumscribing rectangle in FIG. 1,the target region may include a plurality of circumscribing rectanglesas described above. Note that, however, in the case of acquiring a pairof representative colors from the two circumscribing rectangles, theassumption is required that the color settings of two text letters arethe same.

FIG. 2 shows an example where the target region L is composed of twocircumscribing rectangles La and Lb. The circumscribing rectangle La isa region where the translucent text Ka is superimposed on the backgroundJa, and the circumscribing rectangle Lb is a region where thetranslucent text Kb is superimposed on the background Jb. In the exampleof FIG. 2, the image processing device 10 acquires one pair from each ofthe two circumscribing rectangles obtained from adjacent two textletters. Specifically, the image processing device 10 acquires a pair ofthe representative color O₁ of the background region and therepresentative color I₁ of the text region from the circumscribingrectangle La, and acquires a pair of the representative color O₂ of thebackground region and the representative color I₂ of the text regionfrom the circumscribing rectangle Lb. In this case also, the imageprocessing device 10 specifies the text color T and the transparency rof the translucent text itself from the two pairs, and restores theoriginal color of each pixel in the text region from the color of thetranslucent text itself and the color of the text region. As describedabove, this processing is based on the assumption that the basic colorand the transparency of a plurality of text letters to be processed arethe same.

Note that the shape of a target region is not limited to a rectangle,and a target region may be in any shape as long as it contains a textregion.

FIG. 3 shows a hardware configuration of the image processing device 10.The image processing device 10 includes a CPU 101 that executes anoperating system, an application program and the like, a main storageunit 102 such as ROM and RAM, an auxiliary storage unit 103 such as ahard disk or a flash memory, a communication control unit 104 such as anetwork card or a wireless communication module, an input device 105such as a keyboard and a mouse, and an output device 106 such as adisplay.

The functional elements of the image processing device 10, which aredescribed later, are implemented by loading given software onto the CPU101 or the main storage unit 102, making the communication control unit104, the input device 105, the output device 106 and the like operateunder control of the CPU 101, and performing reading and writing of datain the main storage unit 102 or the auxiliary storage unit 103. The dataand databases required for processing are stored in the main storageunit 102 or the auxiliary storage unit 103.

Note that the image processing device 10 may be composed of one computeror may be composed of a plurality of computers.

As shown in FIG. 4, the image processing device 10 includes, asfunctional elements, an acquisition unit 11, a text color specifyingunit (pair acquisition unit, first specifying unit) 12, and arestoration unit (second specifying unit) 13.

The acquisition unit 11 is a functional element that acquires the edgebetween a background region and a text region. The acquisition unit 11can acquire information of the edge of each target region by using anarbitrary method.

The acquisition unit 11 may acquire image data to which information of atarget region and an edge are added from a device (not shown) other thanthe image processing device 10.

Alternatively, the acquisition unit 11 may perform color processing tospecify a target region in image data, and further detect an edge ineach target region by using the existing technique such as the Cannymethod.

One technique of the color processing is color clustering, which is onetype of region-based approach. This technique reduces the number ofcolors by using the k-means method for clustering and, after clustering,divides a region for each color cluster based on topology analysis.Another technique of the color processing is classifier-based approach,such as support vector machine (SVM). Alternatively, a target region maybe extracted by performing postprocessing by classifier-based approachafter using region-based approach.

In this manner, there are various techniques to acquire a target regionand an edge. The acquisition unit 11 outputs information of the edge ofeach target region to the text color specifying unit 12.

The text color specifying unit 12 is a functional element that specifiesthe text color and the transparency of translucent text. The “text colorof translucent text” is not the apparent color but the color (basiccolor) that serves as a basis for the apparent color. Because thetranslucent text part in an image is mixed with the background, it isnecessary to know the color of the translucent text itself. The textcolor specifying unit 12 specifies the color for each target region inthe following way.

The text color specifying unit 12 acquires two pairs of therepresentative color of the text region and the representative color ofthe background region which are adjacent to each other with the edgeplaced therebetween as shown in FIGS. 1 and 2. The reason of acquiringthe representative color of each region, not the color of each pixel, isto facilitate calculation. The text color specifying unit 12 divideseach of the text region and the background region into a plurality ofclusters by using color clustering and obtains the representative colorof each cluster. The way of determining the representative color is notlimited, and the text color specifying unit 12 may set the statistics(average, median etc.) of pixel colors in a cluster as therepresentative color, for example. Alternatively, the text colorspecifying unit 12 may use the representative color of each clusterwhich is input by a user. After that, the text color specifying unit 12specifies the cluster of the text region and the cluster of thebackground region which are adjacent to each other with the edge placedtherebetween as a pair, and obtains the representative color of eachcluster in the pair. At this time, the text color specifying unit 12acquires two pairs.

In the example of FIGS. 1 and 2, the text color specifying unit 12acquires a pair of the representative color I₁ in the text region andthe representative color O₁ in the background region and a pair of therepresentative color I₂ in the text region and the representative colorO₂ in the background region.

Then, the text color specifying unit 12 applies information of the twopairs to the above equation (1) and thereby obtains the followingsimultaneous equations (2).O ₁ r+(1−r)T=I ₁O ₂ r+(1−r)T=I ₂  (2)

After that, the text color specifying unit 12 solves the simultaneousequations (2) and thereby obtains the text color T and the transparencyr of the translucent text itself. The values T and r are obtained by thefollowing equations (3) and (4).T=(I ₁ −O ₁ r)/(1−r)=(I ₂ −O ₂ r)/(1−r)  (3)r=(I ₁ −I ₂)/(O ₁ −O ₂)  (4)

After obtaining the values T and r for each target region, the textcolor specifying unit 12 outputs information of the target region towhich the values T and r for the translucent text have been added to therestoration unit 13.

The restoration unit 13 is a functional element that restores theoriginal color of the background covered by translucent text. Therestoration unit 13 performs the following processing on each targetregion.

When the number of pixels in the text region to be restored is N, therestoration unit 13 obtains the original color O_(org) of each of thepixels p₁ to p_(N) by using the above equation (1).

Specifically, the restoration unit 13 applies the color (i.e. thecurrent pixel color) I_(c) of the pixel p_(i) after the translucent textis superimposed and the text color T and the transparency r of thetranslucent text input from the text color specifying unit 12 to theequation (1) and thereby obtains the color O_(org) of the pixel p_(i)before the translucent text is superimposed (the following equation(5)). Then, the restoration unit 13 changes the color of the pixel p_(i)from I_(c) to O_(org).I _(c) =O _(org) r+(1−r)TAccordingly, O _(org) ={I _(c)−(1−r)T}/r  (5)

The restoration unit 13 changes the pixel color of all of the pixels p₁to p_(N) by using the above equation (5) and thereby removes thetranslucent text and restores the original background color.

After performing the above processing for all target regions, therestoration unit 13 outputs data of the image in which the background isrestored. The way of output is not limited, and the restoration unit 13may store the restored image data into an arbitrary storage device (notshown) or display the restored image on a monitor or print it out.

The operation of the image processing device 10 is described, andfurther an image processing method according to this embodiment isdescribed hereinafter with reference to FIG. 5. To facilitate theexplanation, the processing for one target region is describedhereinbelow.

First, the acquisition unit 11 acquires one target region from a textimage (Step S11, acquisition step), and acquires information of an edgein the target region (Step S12, acquisition step).

Next, the text color specifying unit 12 acquires two pairs of therepresentative color in the text region and the representative color inthe background region which are adjacent to each other with the edgeplaced therebetween (Step S13, pair acquisition step). The text colorspecifying unit 12 then substitutes information of the two pairs (tworepresentative colors in the text region and two representative colorsin the background region) to the above simultaneous equations (2) andthereby obtains the text color and the transparency of the translucenttext (Step S14, first specifying step).

Then, the restoration unit 13 applies the text color and thetransparency of the translucent text and the current pixel color to theabove equation (1) for one pixel in the text region and therebyspecifies the original pixel color (Step S15, second specifying step).After that, the restoration unit 13 replaces the current pixel colorwith the specified color and thereby restores the original color of thepixel (Step S16). The restoration unit 13 performs this processing forall pixels in the text region (see Step S17).

In the case where a plurality of target regions are extracted from atext image, the processing of Steps S11 to S17 is performed for each ofthe target regions and, in the end, image data in which the translucenttext is removed and the background is restored is output.

An image processing program P for implementing the image processingdevice 10 is described hereinafter with reference to FIG. 6.

The image processing program P includes a main module P10, anacquisition module P11, a text color specifying module P12, and arestoration module P13.

The main module P10 is a part that exercises control over the imageprocessing function. The functions implemented by executing theacquisition module P11, the text color specifying module P12 and therestoration module P13 are equal to the functions of the acquisitionunit 11, the text color specifying unit 12, and the restoration unit 13described above, respectively.

The image processing program P may be provided in the form of beingrecorded in a static manner on a tangible recording medium such asCD-ROM or DVD-ROM or semiconductor memory, for example. Further, theimage processing program P may be provided as a data signal superimposedonto a carrier wave through a communication network.

As described above, according to this embodiment, the text color and thetransparency of translucent text itself are obtained from a plurality ofpairs of the representative color of the text region and therepresentative color of the background region. Because the pixel colorof the text region is the mixture of the pixel color before text issuperimposed (original background color) and the color of the textitself, if the color of the translucent text itself is determined, thepixel color of the text region can be restored to the originalbackground color. In this manner, by obtaining the color of thetranslucent text itself and then specifying the pixel color beforesuperimposition for each pixel in the text region, it is possible tomore reliably restore the original background on a pixel-by-pixel basis.Because the original background can be restored on a pixel-by-pixelbasis, it is possible to restore a part that is completely covered bytranslucent text and not continuous with the exposed background region,such as the regions Jp and Jq in FIG. 1, to the original color or thecolor close to that color.

An embodiment of the present invention is described in detail above.However, the present invention is not limited to the above-describedembodiment. Various changes and modifications may be made to the presentinvention without departing from the scope of the invention.

[Use of HOG] The text color specifying unit 12 may use Histogram ofOriented Gradient (HOG) to obtain the representative color, inconsideration of the case where the boundary in the background and theedge of text happen to overlap. HOG is a technique that utilizes thecharacteristics that, for a pair of edge pixels that form a text width,the slope of the edge of the both is the same but the orientation ofeach edge is opposite to each other.

This technique is described hereinafter with reference to FIG. 7. In theexample of FIG. 7, the boundary between the background region with therepresentative color O₂ and the background region with therepresentative color O₃ overlaps the edge part of the translucent text“T”. Because the representative color O₃ is not affected by the textregion at all, use of the representative color O₃ as a part of a paircauses an error in the result of calculation of the text color and thetransparency of the translucent text itself.

To avoid this, the text color specifying unit 12 searches for a partwhere the cluster of a text region is placed between the clusters of twobackground regions with the same representative color by using HOG, anduses the representative colors of the clusters that meet this conditionas a pair. In the example of FIG. 7, the cluster of the text region withthe representative color I₁ is placed between the clusters of the twobackground regions with the representative color O₁. Thus, the textcolor specifying unit 12 generates a pair of the two representativecolors I₁ and O₁. On the other hand, the cluster of the text region withthe representative color I₁ is not placed between the clusters of thetwo background regions with the representative color O₂ and not placedbetween the clusters of the two background regions with therepresentative color O₃. Thus, the text color specifying unit 12 doesnot generate a pair including the representative color I₂. In this case,the text color specifying unit 12 needs to obtain a pair ofrepresentative colors from another circumscribing rectangle.

[Anti-aliasing] When translucent text is inserted, anti-aliasing thatsmoothes the edge of text is performed in some cases. Pixels arearranged in the horizontal direction (x-direction) and the verticaldirection (y-direction), and anti-aliasing is performed for the outline(edge) of text that runs obliquely to the lines of pixels. As a resultof anti-aliasing, the pixels have a color between the background colorand the text color. The above equation (1) cannot be applied to thepixels on which anti-aliasing has been performed. For example, in theexample of FIG. 8, this processing has been performed in the outline ofsubstantially the right half of the text “R”, and if the equation (1) isapplied to this part, the accuracy of restoration decreases. Thus, inorder to further enhance the accuracy of restoration, the imageprocessing device 10 may exclude or remove the anti-alias by thefollowing technique.

The image processing device 10 may remove the anti-alias by changing thepixels on which anti-aliasing has been performed to either one of thecolor of a pixel on which it is not performed in the text region or thecolor of a pixel in the background region adjacent to the edge.

Specifically, the image processing device 10 acquires a small region ofW×W pixels centering on the pixel determined as an edge (edge pixel).Although a specific value of W is not limited, the value needs to be setto at least include the part where anti-aliasing has been applied. Forexample, the value may be W=3.

Next, the image processing device 10 plots the pixels in this region ona three-dimensional coordinate system indicating the RGB color space andobtains the approximate straight line that fits those pixels. The imageprocessing device 10 can obtain the approximate straight line by usingthe least squares method, RANSAC (RANdom SAmple Consensus), LMedS (LeastMEDian Square) and the like.

Then, the image processing device 10 projects the points indicatingpixels on the straight line and specifies two pixels corresponding tothe two projected points (end points) located at both ends on thestraight line as reference pixels. The image processing device 10 thenchanges the color of the remaining pixels other than the referencepixels to either one of the colors of the two reference pixels (thefirst reference value and the second reference value). Specifically,when one remaining pixel is p_(r) the image processing device 10 selectsthe color of the reference pixel at the shorter distance from the pixelp_(r) as the color of the pixel p_(r). Note that the distance betweenthe pixel p_(r) and the reference pixel may be the actual distancebetween the points plotted on the three-dimensional coordinate system orthe distance between the projected points on the approximate straightline.

In this manner, the image processing device removes the anti-alias bytransforming the region around the edge to binary values. This removalprocessing may be performed at any time before the restoration unit 13carries out the restoration processing. For example, the removalprocessing may be performed before the text color specifying unit 12selects a pair of representative colors. Thus, the removal processingmay be performed by the text color specifying unit 12 or the restorationunit 13. In this case, the text color specifying unit 12 or therestoration unit 13 functions also as an inverse transform unit.

Alternatively, the text color specifying unit 12 may remove the clustercontaining the pixel on which anti-aliasing has been performed whenselecting the representative color of the cluster in the text region.Specifically, the text color specifying unit 12 may acquire therepresentative color of each of the text region and the backgroundregion adjacent to each other with the edge placed therebetween, whichextends in the direction (the x-direction or y-direction) along theouter edge of the circumscribing rectangle, and generate a pair of thoserepresentative colors.

Alternatively, when the text color specifying unit 12 selects therepresentative color of a cluster in the text region, it may select themedian or average of the pixel values contained the cluster as therepresentative color. Alternatively, the text color specifying unit 12may calculate the histogram of color and select the color indicating thehighest value (the color with the highest frequency of appearance) asthe representative color. Because there are only few pixels on whichanti-aliasing has been performed and they are exceptional, it ispossible to reduce the effect of anti-aliasing by using the statistics(for example, the median, the average or the highest frequency ofappearance) of pixel values in this manner.

The image processing device 10 may have the function of determiningwhether text is translucent or solid. In this case, the image processingdevice 10 (for example, the acquisition unit 11) may determine that itis translucent text when the pixel values in the text region aredispersed and determine that it is solid text when the pixel values arenot dispersed. Alternatively, the image processing device 10 (forexample, the acquisition unit 11) may determine that it is translucenttext when there is an edge that is continuous from the background regionto the text region.

REFERENCE SIGNS LIST

10 . . . image processing device, 11 . . . acquisition unit, 12 . . .text color specifying unit (pair acquisition unit, first specifyingunit), 13 . . . restoration unit (second specifying unit), P . . . imageprocessing program, P10 . . . main module, P11 . . . acquisition module,P12 . . . text color specifying module, P13 . . . restoration module

The invention claimed is:
 1. An image processing device for processingan image where translucent text is superimposed on an original image,comprising: at least one memory operable to store computer programinstructions; at least one processor operable to access said at leastone memory, read said program instructions, and operate according tosaid program instructions, said program instructions including:acquisition instructions configured to cause at least one of said atleast one processor to acquire an edge between a text region where thetranslucent text is superimposed and a background region where thetranslucent text is not superimposed; pair acquisition instructionsconfigured to cause at least one of said at least one processor toacquire a first pair of a first superimposition color in the text regionand a first background color in the background region adjacent to eachother with the edge placed therebetween and a second pair of a secondsuperimposition color in the text region and a second background colorin the background region adjacent to each other with the edge placedtherebetween, the second superimposition color being different from thefirst superimposition color and the second background color beingdifferent from the first background color; first specifying instructionsconfigured to cause at least one of said at least one processor tospecify a text color and transparency of the translucent text by usingthe first pair and the second pair; and second specifying instructionsconfigured to cause at least one of said at least one processor tospecify a pixel color before the translucent text is superimposed foreach pixel in the text region from a pixel color after the translucenttext is superimposed, the text color and the transparency.
 2. The imageprocessing device according to claim 1, wherein a superimposition colorof each pixel in the text region where the translucent text issuperimposed is determined by a relational expression representing arelationship between the superimposition color, a color of acorresponding pixel in the original image, and the text color and thetransparency of the translucent text, and the first specifyinginstructions are further configured to cause at least one of said atleast one processor to specify the text color and the transparency ofthe translucent text based on a first equation where the first pair issubstituted into the relational expression and a second equation wherethe second pair is substituted into the relational expression, and thesecond specifying instructions configured to cause at least one of saidat least one processor to specify a pixel value in the original imagefor each pixel in the text region based on the text color and thetransparency of the translucent text and the relational expression. 3.The image processing device according to claim 1, wherein the firstspecifying instructions are further configured to cause at least one ofsaid at least one processor to perform color clustering to acquire aplurality of pairs of a cluster of the text region and a cluster of thebackground region and acquire a representative color of each cluster tothereby acquire a plurality of pairs of a representative color in thetext region and a representative color in the background region.
 4. Theimage processing device according to claim 3, wherein the firstspecifying instructions are further configured to cause at least one ofsaid at least one processor to acquire a pair of a cluster of the textregion and a cluster of the background region when the cluster of thetext region is placed between the clusters of the two background regionswith the same representative color.
 5. The image processing deviceaccording to claim 1, further comprising: inverse transform instructionsconfigured to cause at least one of said at least one processor toobtain a range of pixel values in a small region centering on an edge ofthe translucent text on which anti-aliasing has been performed, andbinarize each pixel value in the small region to one of a firstreference value and a second reference value, wherein the firstreference value and the second reference value are end points of therange of pixel values.
 6. The image processing device according to claim1, wherein the first specifying instructions are further configured tocause at least one of said at least one processor to acquire arectangular region including the background region and the text regionwhere the translucent text on which anti-aliasing has been performed islocated, and acquire the representative color of each of the text regionand the background region adjacent to each other with the edge in adirection along an outer edge of the rectangle region placedtherebetween.
 7. The image processing device according to claim 3,wherein the first specifying instructions are further configured tocause at least one of said at least one processor to acquire statisticsof pixel values of each cluster as a representative color.
 8. The imageprocessing device according to claim 1, wherein the acquisitioninstructions are further configured to cause at least one of said atleast one processor to determine that text is translucent when pixelvalues of a text part are dispersed.
 9. The image processing deviceaccording to claim 1, wherein the acquisition instructions are furtherconfigured to cause at least one of said at least one processor todetermine that text is translucent when there is an edge continuous fromthe background region to the text region.
 10. An image processing methodperformed by at least one processor in an image processing device forprocessing an image where translucent text is superimposed on anoriginal image, the method comprising: acquiring an edge between a textregion where the translucent text is superimposed and a backgroundregion where the translucent text is not superimposed; acquiring a firstpair of a first superimposition color in the text region and a firstbackground color in the background region adjacent to each other withthe edge placed therebetween and a second pair of a secondsuperimposition color in the text region and a second background colorin the background region adjacent to each other with the edge placedtherebetween, the second superimposition color being different from thefirst superimposition color and the second background color beingdifferent from the first background color; specifying a text color andtransparency of the translucent text by using the first pair and thesecond pair; and specifying a pixel color before the translucent text issuperimposed for each pixel in the text region from a pixel color afterthe translucent text is superimposed, the text color and thetransparency.
 11. A non-transitory computer-readable recording mediumstoring an image processing program causing a computer to function as animage processing device for processing an image where translucent textis superimposed on an original image, the program causing the computerto: acquire an edge between a text region where the translucent text issuperimposed and a background region where the translucent text is notsuperimposed; acquire a first pair of a first superimposition color inthe text region and a first background color in the background regionadjacent to each other with the edge placed therebetween and a secondpair of a second superimposition color in the text region and a secondbackground color in the background region adjacent to each other withthe edge placed therebetween, the second superimposition color beingdifferent from the first superimposition color and the second backgroundcolor being different from the first background color; specify a textcolor and transparency of the translucent text by using the first pairand the second pair; and specify a pixel color before the translucenttext is superimposed for each pixel in the text region from a pixelcolor after the translucent text is superimposed, the text color and thetransparency.